{% extends "base.html" %}
{% block title %}
    修改用户
{% endblock %}
{% block main %}
    <div class="col-10 offset-1">
        <div class="card card-primary">
            <div class="card-header">
                <h3 class="card-title">用户信息</h3>
            </div>
            <form method="post" id="userForm" class="form-horizontal">
               {% csrf_token %}
                <input type="hidden" name="id" value="{{ user.id }}">
                <div class="card-body">
                    <div class="form-group">
                        <label>用户名</label>
                        <input value="{{ user.username }}" disabled type="text" name="username"
                               class="form-control" placeholder="用户名">
                    </div>
                    <div class="form-group">
                        <label>真实姓名</label>
                        <input value="{{ user.real_name }}" type="text" name="real_name" class="form-control"
                               placeholder="真实姓名">
                    </div>
                    <div class="form-group ">
                        <label>联系电话</label>
                        <input name="phone" value="{{ user.phone }}" type="text" class="form-control"
                               placeholder="联系电话">
                    </div>
                    <div class="form-group ">
                        <label>联系邮箱</label>
                        <input name="email" value="{{ user.email }}" type="email" class="form-control"
                               placeholder="联系邮箱">
                    </div>
                    <div class="form-group ">
                        <label>性别</label>
                        <select name="sex" class="form-control">
                            {% if user.sex == '男' %}
                                <option value="男" selected>男</option>
                                <option value="女">女</option>
                            {% endif %}
                            {% if user.sex == '女' %}
                                <option value="男">男</option>
                                <option value="女" selected>女</option>
                            {% endif %}
                        </select>
                    </div>

                    <div class="form-group ">
                        <label>账号状态</label>
                        <select name="status" class="form-control">
                            {% if user.status == 0 %}
                                <option value="0" selected>启用</option>
                                <option value="1">禁用</option>
                            {% endif %}
                            {% if user.status == 1 %}
                                <option value="0">启用</option>
                                <option value="1" selected>禁用</option>
                            {% endif %}
                        </select>
                    </div>
                </div>
                <!-- /.card-body -->
                <div class="card-footer">
                    <div class="row">
                        <div class="col-4 offset-1">
                            <button type="submit" class="btn btn-primary btn-block">立即修改</button>
                        </div>
                        <div class="col-4 offset-1">
                            <button onclick="history.back()" type="submit"
                                    class="btn btn-default btn-block">返回
                            </button>
                        </div>
                    </div>
                </div>
                <!-- /.card-footer -->
            </form>
        </div>
    </div>
{% endblock %}
{% block script %}
    <script src="/static/dist/js/user-update.js"></script>
{% endblock %}
